#ifndef QLSAVPACKETQUEUE_H
#define QLSAVPACKETQUEUE_H

extern "C"
{
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include <libavutil/time.h>
#include "libavutil/imgutils.h"
#include "libswscale/swscale.h"
#include "libswresample/swresample.h"

#include <SDL.h>
#include <SDL_audio.h>
#include <SDL_types.h>
#include <SDL_name.h>
#include <SDL_main.h>
#include <SDL_config.h>
}

/* 数据包队列 */
class QLsAVPacketQueue
{
public:
	QLsAVPacketQueue();
	~QLsAVPacketQueue();

	AVPacketList *m_firstPkt, *m_lastPkt;
	int m_nbPackets;
	int m_size;
	SDL_mutex *m_mutex;
	SDL_cond *m_cond;

	/* 入队 */
	void Enqueue(AVPacket *pkt);
	/* 获取队头包 */
	bool Get(AVPacket *pkt);
	/* 出队 */
	void Dequeue();
	/* 提取对头包 = 获取队头包 + 出队 */
	bool PopFront(AVPacket *pkt);
	/* 清空 */
	void Clear();
};

#endif // QLSAVPACKETQUEUE_H
